USE [Bases2]
GO
/****** Object:  Table [dbo].[PERMISOS]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[PERMISOS](
	[id_permisos] [int] NOT NULL,
	[nombre] [varchar](100) NOT NULL,
	[estado] [bit] NOT NULL,
	[menu] [varchar](200) NULL,
	[titulomenu] [varchar](200) NULL,
 CONSTRAINT [PERMISOS PK] PRIMARY KEY NONCLUSTERED 
(
	[id_permisos] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[LOG]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[LOG](
	[id_log] [int] NOT NULL,
	[id_folio] [int] NOT NULL,
	[id_cheque] [int] NOT NULL,
	[id_cuenta] [int] NOT NULL,
	[saldo_inicial] [decimal](18, 2) NOT NULL,
	[monto] [decimal](18, 2) NOT NULL,
	[saldo_final] [decimal](18, 2) NOT NULL,
	[descripcion] [varchar](200) NOT NULL,
	[fecha] [datetime] NOT NULL,
	[id_usuario] [int] NOT NULL,
 CONSTRAINT [PK_LOG] PRIMARY KEY CLUSTERED 
(
	[id_log] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TIPO_USUARIO]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TIPO_USUARIO](
	[id_tipo_usuario] [int] NOT NULL,
	[nombre] [varchar](50) NOT NULL,
 CONSTRAINT [TIPO_USUARIO PK] PRIMARY KEY NONCLUSTERED 
(
	[id_tipo_usuario] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TIPO_TRANSACCION]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TIPO_TRANSACCION](
	[id_transaccion] [int] NOT NULL,
	[nombre] [varchar](100) NOT NULL,
 CONSTRAINT [TIPO_TRANSACCION PK] PRIMARY KEY NONCLUSTERED 
(
	[id_transaccion] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TIPO_ESTADO]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TIPO_ESTADO](
	[id_tipo_estado] [int] NOT NULL,
	[nombre] [varchar](100) NOT NULL,
 CONSTRAINT [TIPO_ESTADO PK] PRIMARY KEY NONCLUSTERED 
(
	[id_tipo_estado] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TIPO_CUENTA]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TIPO_CUENTA](
	[id_tipo_cuenta] [int] NOT NULL,
	[nombre] [varchar](50) NOT NULL,
 CONSTRAINT [TIPO_CUENTA PK] PRIMARY KEY NONCLUSTERED 
(
	[id_tipo_cuenta] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TIPO_CLIENTE]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TIPO_CLIENTE](
	[id_tipo_cliente] [int] NOT NULL,
	[nombre] [varchar](50) NOT NULL,
 CONSTRAINT [TIPO_CLIENTE PK] PRIMARY KEY NONCLUSTERED 
(
	[id_tipo_cliente] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[BANCO]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[BANCO](
	[id_banco] [int] NOT NULL,
	[nombre] [varchar](50) NOT NULL,
 CONSTRAINT [BANCO PK] PRIMARY KEY NONCLUSTERED 
(
	[id_banco] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[AGENCIA]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[AGENCIA](
	[id_agenda] [int] NOT NULL,
	[nombre] [varchar](100) NOT NULL,
	[id_banco] [int] NOT NULL,
 CONSTRAINT [AGENCIA PK] PRIMARY KEY NONCLUSTERED 
(
	[id_agenda] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CLIENTE]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CLIENTE](
	[id_cliente] [int] NOT NULL,
	[nombre] [varchar](50) NOT NULL,
	[apellido] [varchar](50) NULL,
	[cedula] [varchar](15) NULL,
	[id_tipo_cliente] [int] NOT NULL,
	[foto] [image] NULL,
	[firma] [image] NULL,
	[nit] [int] NULL,
 CONSTRAINT [CLIENTE PK] PRIMARY KEY NONCLUSTERED 
(
	[id_cliente] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CUENTA]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CUENTA](
	[id_cuenta] [int] NOT NULL,
	[id_banco] [int] NOT NULL,
	[id_tipo_cuenta] [int] NOT NULL,
 CONSTRAINT [CUENTA PK] PRIMARY KEY NONCLUSTERED 
(
	[id_cuenta] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PERMISOS_TIPO_USUARIO]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PERMISOS_TIPO_USUARIO](
	[id_tipo_usuario] [int] NOT NULL,
	[id_permisos] [int] NOT NULL,
 CONSTRAINT [PK_PERMISOS_TIPO_USUARIO] PRIMARY KEY NONCLUSTERED 
(
	[id_tipo_usuario] ASC,
	[id_permisos] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FOLIO]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FOLIO](
	[id_folio] [int] NOT NULL,
	[fecha] [date] NOT NULL,
	[id_banco] [int] NOT NULL,
 CONSTRAINT [PK_FOLIO] PRIMARY KEY CLUSTERED 
(
	[id_folio] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[USUARIO]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[USUARIO](
	[id_usuario] [int] NOT NULL,
	[nombre] [varchar](100) NOT NULL,
	[password] [varchar](50) NOT NULL,
	[id_tipo_usuario] [int] NOT NULL,
	[habilitado] [bit] NULL,
 CONSTRAINT [USUARIO PK] PRIMARY KEY NONCLUSTERED 
(
	[id_usuario] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[BITACORA]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[BITACORA](
	[id_bitacora] [int] NOT NULL,
	[fecha] [datetime] NOT NULL,
	[id_usuario] [int] NOT NULL,
	[id_cuenta] [int] NOT NULL,
	[saldo_inicial] [decimal](18, 2) NOT NULL,
	[monto] [decimal](18, 2) NOT NULL,
	[saldo_final] [decimal](18, 2) NOT NULL,
	[descripcion] [varchar](200) NULL,
 CONSTRAINT [PK_BITACORA] PRIMARY KEY NONCLUSTERED 
(
	[id_bitacora] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[DEPOSITO]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DEPOSITO](
	[id_deposito] [int] NOT NULL,
	[monto] [decimal](18, 2) NOT NULL,
	[id_cuenta] [int] NOT NULL,
	[id_agenda] [int] NOT NULL,
	[compensado] [bit] NOT NULL,
	[id_cheque] [int] NULL,
 CONSTRAINT [DEPOSITO PK] PRIMARY KEY NONCLUSTERED 
(
	[id_deposito] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DEBITO]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DEBITO](
	[id_debito] [int] NOT NULL,
	[monto] [decimal](18, 2) NOT NULL,
	[id_agenda] [int] NOT NULL,
	[id_cuenta] [int] NOT NULL,
 CONSTRAINT [DEBITO PK] PRIMARY KEY NONCLUSTERED 
(
	[id_debito] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FOLIO_CHEQUE]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[FOLIO_CHEQUE](
	[id_cheque] [int] NOT NULL,
	[id_cuenta] [int] NOT NULL,
	[monto] [decimal](18, 2) NOT NULL,
	[id_folio] [int] NOT NULL,
	[estado] [varchar](200) NULL,
 CONSTRAINT [PK_FOLIO_CHEQUE] PRIMARY KEY CLUSTERED 
(
	[id_cheque] ASC,
	[id_folio] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[ESTADO_CUENTA]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ESTADO_CUENTA](
	[id_estado_cuenta] [int] NOT NULL,
	[descripcion] [varchar](200) NULL,
	[estado] [bit] NOT NULL,
	[fecha] [datetime] NOT NULL,
	[id_tipo_estado] [int] NOT NULL,
	[id_cuenta] [int] NOT NULL,
	[id_usuario] [int] NOT NULL,
 CONSTRAINT [ESTADO PK] PRIMARY KEY NONCLUSTERED 
(
	[id_estado_cuenta] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[CLIENTE_CUENTA]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CLIENTE_CUENTA](
	[id_cuenta] [int] NOT NULL,
	[id_cliente] [int] NOT NULL,
 CONSTRAINT [PK_CLIENTE_CUENTA] PRIMARY KEY NONCLUSTERED 
(
	[id_cuenta] ASC,
	[id_cliente] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CHEQUERA]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CHEQUERA](
	[id_chequera] [int] NOT NULL,
	[id_cuenta] [int] NOT NULL,
 CONSTRAINT [CHEQUERA PK] PRIMARY KEY NONCLUSTERED 
(
	[id_chequera] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[CHEQUE]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CHEQUE](
	[id_cheque] [int] NOT NULL,
	[id_chequera] [int] NOT NULL,
	[cobrado] [bit] NOT NULL,
	[id_deposito] [int] NULL,
 CONSTRAINT [PK_CHEQUE] PRIMARY KEY CLUSTERED 
(
	[id_cheque] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ESTADO_CHEQUE]    Script Date: 12/01/2011 14:12:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ESTADO_CHEQUE](
	[id_estado_cheque] [int] NOT NULL,
	[detalle] [varchar](200) NULL,
	[estado] [bit] NOT NULL,
	[fecha] [datetime] NOT NULL,
	[id_tipo_estado] [int] NOT NULL,
	[id_cheque] [int] NOT NULL,
	[id_usuario] [int] NOT NULL,
 CONSTRAINT [ESTADO_CHEQUE PK] PRIMARY KEY NONCLUSTERED 
(
	[id_estado_cheque] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  ForeignKey [Relation_14]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[AGENCIA]  WITH CHECK ADD  CONSTRAINT [Relation_14] FOREIGN KEY([id_banco])
REFERENCES [dbo].[BANCO] ([id_banco])
GO
ALTER TABLE [dbo].[AGENCIA] CHECK CONSTRAINT [Relation_14]
GO
/****** Object:  ForeignKey [Relation_20]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[BITACORA]  WITH CHECK ADD  CONSTRAINT [Relation_20] FOREIGN KEY([id_usuario])
REFERENCES [dbo].[USUARIO] ([id_usuario])
GO
ALTER TABLE [dbo].[BITACORA] CHECK CONSTRAINT [Relation_20]
GO
/****** Object:  ForeignKey [Relation_22]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[BITACORA]  WITH CHECK ADD  CONSTRAINT [Relation_22] FOREIGN KEY([id_cuenta])
REFERENCES [dbo].[CUENTA] ([id_cuenta])
GO
ALTER TABLE [dbo].[BITACORA] CHECK CONSTRAINT [Relation_22]
GO
/****** Object:  ForeignKey [Relation_24]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[CHEQUE]  WITH CHECK ADD  CONSTRAINT [Relation_24] FOREIGN KEY([id_chequera])
REFERENCES [dbo].[CHEQUERA] ([id_chequera])
GO
ALTER TABLE [dbo].[CHEQUE] CHECK CONSTRAINT [Relation_24]
GO
/****** Object:  ForeignKey [Relation_19]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[CHEQUERA]  WITH CHECK ADD  CONSTRAINT [Relation_19] FOREIGN KEY([id_cuenta])
REFERENCES [dbo].[CUENTA] ([id_cuenta])
GO
ALTER TABLE [dbo].[CHEQUERA] CHECK CONSTRAINT [Relation_19]
GO
/****** Object:  ForeignKey [Relation_4]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[CLIENTE]  WITH CHECK ADD  CONSTRAINT [Relation_4] FOREIGN KEY([id_tipo_cliente])
REFERENCES [dbo].[TIPO_CLIENTE] ([id_tipo_cliente])
GO
ALTER TABLE [dbo].[CLIENTE] CHECK CONSTRAINT [Relation_4]
GO
/****** Object:  ForeignKey [Relation_38]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[CLIENTE_CUENTA]  WITH CHECK ADD  CONSTRAINT [Relation_38] FOREIGN KEY([id_cuenta])
REFERENCES [dbo].[CUENTA] ([id_cuenta])
GO
ALTER TABLE [dbo].[CLIENTE_CUENTA] CHECK CONSTRAINT [Relation_38]
GO
/****** Object:  ForeignKey [Relation_39]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[CLIENTE_CUENTA]  WITH CHECK ADD  CONSTRAINT [Relation_39] FOREIGN KEY([id_cliente])
REFERENCES [dbo].[CLIENTE] ([id_cliente])
GO
ALTER TABLE [dbo].[CLIENTE_CUENTA] CHECK CONSTRAINT [Relation_39]
GO
/****** Object:  ForeignKey [Relation_10]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[CUENTA]  WITH CHECK ADD  CONSTRAINT [Relation_10] FOREIGN KEY([id_banco])
REFERENCES [dbo].[BANCO] ([id_banco])
GO
ALTER TABLE [dbo].[CUENTA] CHECK CONSTRAINT [Relation_10]
GO
/****** Object:  ForeignKey [Relation_12]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[CUENTA]  WITH CHECK ADD  CONSTRAINT [Relation_12] FOREIGN KEY([id_tipo_cuenta])
REFERENCES [dbo].[TIPO_CUENTA] ([id_tipo_cuenta])
GO
ALTER TABLE [dbo].[CUENTA] CHECK CONSTRAINT [Relation_12]
GO
/****** Object:  ForeignKey [Relation_15]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[DEBITO]  WITH CHECK ADD  CONSTRAINT [Relation_15] FOREIGN KEY([id_agenda])
REFERENCES [dbo].[AGENCIA] ([id_agenda])
GO
ALTER TABLE [dbo].[DEBITO] CHECK CONSTRAINT [Relation_15]
GO
/****** Object:  ForeignKey [Relation_16]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[DEBITO]  WITH CHECK ADD  CONSTRAINT [Relation_16] FOREIGN KEY([id_cuenta])
REFERENCES [dbo].[CUENTA] ([id_cuenta])
GO
ALTER TABLE [dbo].[DEBITO] CHECK CONSTRAINT [Relation_16]
GO
/****** Object:  ForeignKey [Relation_17]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[DEPOSITO]  WITH CHECK ADD  CONSTRAINT [Relation_17] FOREIGN KEY([id_cuenta])
REFERENCES [dbo].[CUENTA] ([id_cuenta])
GO
ALTER TABLE [dbo].[DEPOSITO] CHECK CONSTRAINT [Relation_17]
GO
/****** Object:  ForeignKey [Relation_18]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[DEPOSITO]  WITH CHECK ADD  CONSTRAINT [Relation_18] FOREIGN KEY([id_agenda])
REFERENCES [dbo].[AGENCIA] ([id_agenda])
GO
ALTER TABLE [dbo].[DEPOSITO] CHECK CONSTRAINT [Relation_18]
GO
/****** Object:  ForeignKey [FK_CHEQUE_ESTADO_CHEQUE]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[ESTADO_CHEQUE]  WITH CHECK ADD  CONSTRAINT [FK_CHEQUE_ESTADO_CHEQUE] FOREIGN KEY([id_cheque])
REFERENCES [dbo].[CHEQUE] ([id_cheque])
GO
ALTER TABLE [dbo].[ESTADO_CHEQUE] CHECK CONSTRAINT [FK_CHEQUE_ESTADO_CHEQUE]
GO
/****** Object:  ForeignKey [Relation_34]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[ESTADO_CHEQUE]  WITH CHECK ADD  CONSTRAINT [Relation_34] FOREIGN KEY([id_tipo_estado])
REFERENCES [dbo].[TIPO_ESTADO] ([id_tipo_estado])
GO
ALTER TABLE [dbo].[ESTADO_CHEQUE] CHECK CONSTRAINT [Relation_34]
GO
/****** Object:  ForeignKey [Relation_36]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[ESTADO_CHEQUE]  WITH CHECK ADD  CONSTRAINT [Relation_36] FOREIGN KEY([id_usuario])
REFERENCES [dbo].[USUARIO] ([id_usuario])
GO
ALTER TABLE [dbo].[ESTADO_CHEQUE] CHECK CONSTRAINT [Relation_36]
GO
/****** Object:  ForeignKey [Relation_29]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[ESTADO_CUENTA]  WITH CHECK ADD  CONSTRAINT [Relation_29] FOREIGN KEY([id_cuenta])
REFERENCES [dbo].[CUENTA] ([id_cuenta])
GO
ALTER TABLE [dbo].[ESTADO_CUENTA] CHECK CONSTRAINT [Relation_29]
GO
/****** Object:  ForeignKey [Relation_32]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[ESTADO_CUENTA]  WITH CHECK ADD  CONSTRAINT [Relation_32] FOREIGN KEY([id_usuario])
REFERENCES [dbo].[USUARIO] ([id_usuario])
GO
ALTER TABLE [dbo].[ESTADO_CUENTA] CHECK CONSTRAINT [Relation_32]
GO
/****** Object:  ForeignKey [Relation_33]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[ESTADO_CUENTA]  WITH CHECK ADD  CONSTRAINT [Relation_33] FOREIGN KEY([id_tipo_estado])
REFERENCES [dbo].[TIPO_ESTADO] ([id_tipo_estado])
GO
ALTER TABLE [dbo].[ESTADO_CUENTA] CHECK CONSTRAINT [Relation_33]
GO
/****** Object:  ForeignKey [FK_FOLIO_BANCO]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[FOLIO]  WITH CHECK ADD  CONSTRAINT [FK_FOLIO_BANCO] FOREIGN KEY([id_banco])
REFERENCES [dbo].[BANCO] ([id_banco])
GO
ALTER TABLE [dbo].[FOLIO] CHECK CONSTRAINT [FK_FOLIO_BANCO]
GO
/****** Object:  ForeignKey [FK_FOLIO_CHEQUE_FOLIO]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[FOLIO_CHEQUE]  WITH CHECK ADD  CONSTRAINT [FK_FOLIO_CHEQUE_FOLIO] FOREIGN KEY([id_folio])
REFERENCES [dbo].[FOLIO] ([id_folio])
GO
ALTER TABLE [dbo].[FOLIO_CHEQUE] CHECK CONSTRAINT [FK_FOLIO_CHEQUE_FOLIO]
GO
/****** Object:  ForeignKey [Relation_25]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[PERMISOS_TIPO_USUARIO]  WITH CHECK ADD  CONSTRAINT [Relation_25] FOREIGN KEY([id_tipo_usuario])
REFERENCES [dbo].[TIPO_USUARIO] ([id_tipo_usuario])
GO
ALTER TABLE [dbo].[PERMISOS_TIPO_USUARIO] CHECK CONSTRAINT [Relation_25]
GO
/****** Object:  ForeignKey [Relation_26]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[PERMISOS_TIPO_USUARIO]  WITH CHECK ADD  CONSTRAINT [Relation_26] FOREIGN KEY([id_permisos])
REFERENCES [dbo].[PERMISOS] ([id_permisos])
GO
ALTER TABLE [dbo].[PERMISOS_TIPO_USUARIO] CHECK CONSTRAINT [Relation_26]
GO
/****** Object:  ForeignKey [Relation_3]    Script Date: 12/01/2011 14:12:49 ******/
ALTER TABLE [dbo].[USUARIO]  WITH CHECK ADD  CONSTRAINT [Relation_3] FOREIGN KEY([id_tipo_usuario])
REFERENCES [dbo].[TIPO_USUARIO] ([id_tipo_usuario])
GO
ALTER TABLE [dbo].[USUARIO] CHECK CONSTRAINT [Relation_3]
GO
